package day02;

/**
 * @author Jetwang
 * @version 1.0
 * @since 2023/3/12 10:05
 */
public class Offer22 {
    public ListNode getKthFromEnd(ListNode head, int k) {
        ListNode p = head;
        for(int i = 0; i < k; i++) {
            p = p.next;
        }
        while(p != null) {
            head = head.next;
            p = p.next;
        }
        return head;
    }
}
